-
-
Notifications
You must be signed in to change notification settings - Fork 3k
perf: return from is_subtype
early
#19400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I guess this caused performance regression for |
Let's see if the restart helps - I've seen this happening randomly elsewhere. |
Isolated benchmarks also look good: sterliakov/mypy-issues#110 This can have negative effect when almost all subtype checks are expected to fail, but the check should be fast enough to compensate for that. Looking at primer logs, all other projects I looked at (~20 instances from five shards) were checked faster with this patch, so this might be net positive anyway. Some long-running examples:
This is obviously not the best indicator, but at least something...
It's not clear whether any of those are reliable, because the run for #19388 shows significantly lower time with expected positive improvement, but is 3 minutes less for master branch:
(failing |
And let's also note that primer runs interpreted mypy, and this equality should play well with mypyc. I'll try running perf_compare on colour today. |
This comment has been minimized.
This comment has been minimized.
In this run there's no colour regression:
but "need type annotation" is mysterious. |
Okay, nothing mysterious, just a separate bug. Please ping me if you don't think this PR should ever be merged, I will extract the bugfix to a separate PR - This was fun to debug - I ended up with And this does indeed improve |
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Our equality implementation is conservative: if two types compare equal, we know for sure they do indeed refer to the same type, and any type is subtype of itself. This saved 0.9% in my local benchmark run.